package db4o;

import pojo.Device;

import com.db4o.ObjectSet;

public class DeviceRemover extends DBManager {

	public void removeDevice(String desc) {
		ObjectSet<Device> result = super.getDbManager().queryByExample(
				new Device(desc, null));
		super.getDbManager().delete(result.next());
	}

	public void removeAllDevices() {
		DeviceRetriver retrive = new DeviceRetriver();
		for (Device d : retrive.getAllDevices()) {
			this.removeDevice(d.getId());
		}
	}

	public void removeDevice(Integer id) {
		ObjectSet<Device> result = super.getDbManager().queryByExample(
				new Device(id, null, null));
		super.getDbManager().delete(result.next());
	}

}
